package com.zhiyou100.video.service.impl;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zhiyou100.video.dao.VideoDao;
import com.zhiyou100.video.model.Course;
import com.zhiyou100.video.model.Speaker;
import com.zhiyou100.video.model.Video;
import com.zhiyou100.video.service.VideoService;
import com.zhiyou100.video.utils.Page;
@Service
public class VideoServiceImpl implements VideoService {
	@Autowired
	VideoDao vd;
	@Override
	public List<Speaker> selectSpeaker() {
		return vd.selectSpeaker();
	}

	

	@Override
	public Page<Video> selectVideo(DetachedCriteria video, Integer currentpage) {
		Page<Video> page = new Page<Video>();
		Integer count = vd.selectCount(video);
		List<Video> list=vd.selectVideo(video,currentpage);
		page.setPage(currentpage);
		page.setRows(list);
		page.setSize(5);
		page.setTotal(count);
		System.out.println(count);
		return page;
	}



	@Override
	public List<Course> selectCourse() {
		return vd.selectCourse();
	}



	@Override
	public void addVideo(Video video) {
		vd.addVideo(video);
		
	}



	@Override
	public void deleteVideo(Integer did) {
			vd.deleteVideo(did);
	}



	@Override
	public Video selectVideol(Integer id) {
		return vd.selectVideol(id);
	}



	@Override
	public List<Video> selectVideok(DetachedCriteria dc) {
		return vd.selectVideok(dc);
		
	}
}
